﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernateSample.Domain.Entities;

namespace NHibernateSample.Data
{
    public class CustomerManage
    {
        protected ISession Session { get; set; }
        public CustomerManage(ISession session)
        {
            Session = session;
        }

        public CustomerManage()
        {
            Session = new NHibernateHelper().GetSession();
        }


        public void CreateCustomer(Customer customer)
        {
            Session.Save(customer);
            Session.Flush();
        }

        public Customer GetCustomerById(int customerId)
        {
            return Session.Get<Customer>(customerId);
        }

    }
}
